package com.lyy.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author Liangyaoyun
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private Integer code;
    private String message;
    private Object data;
    private static final Integer SUCCESS_CODE=1;
    private static final Integer FAILURE_CODE=0;
    private static final String FAILURE_MESSAGE="FAILURE";
    private static final String SUCCESS_MESSAGE="SUCCESS";

    public  static Result success(Object data){
        return new Result(SUCCESS_CODE,SUCCESS_MESSAGE,data);
    }
    public  static Result fail(Object data){
        return new Result(FAILURE_CODE,SUCCESS_MESSAGE,null);
    }
    public  static Result success(){
        return new Result(FAILURE_CODE, FAILURE_MESSAGE,null);
    }
    public  static Result fail(){
        return new Result(FAILURE_CODE,SUCCESS_MESSAGE,null);
    }
}
